package cn.tedu.design;

import org.junit.jupiter.api.Test;

/*
 * 本类用于OOP汽车设计综合案例*/
public class DisgnCar {
    @Test
    public void test() {
        Car car = new Car();
        car.start();
        car.stop();
        HongQi hongQi = new HongQi();
        System.out.println(hongQi.color);//奶糖白
        hongQi.start();
        hongQi.stop();
        BSJ bsj = new BSJ();
        System.out.println(bsj.color);
    }
}

//定义汽车类
class Car {
    private String brand;//品牌
    private String color;//颜色
    private double price;//价格
    private double size;//尺寸

    public void start() {
        System.out.println("Fly");
    }

    public void stop() {
        System.out.println("FBI Warning ,STOP!");
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public double getSize() {
        return size;
    }

    public void setSize(double size) {
        this.size = size;
    }
}

class HongQi extends Car {
    String color = "奶糖白";


    @Override
    public void stop() {
        System.out.println("红旗********Stop");
    }
}

class BSJ extends Car {
    String color = "雅虎黑";


    public void fly() {
        System.out.println("速度是七十迈");
    }
}